<?php
	class ArrayList
	{
		var $list = array();
		
		function ArrayList()
		{
		}
		
		function Add( $obj )
		{
			array_push( $this->list, $obj );
		}
		
		function Get( $index )
		{
			return $this->list[$index];
		}
		
		function RemoveAt( $index )
		{
			$ret = array();
			for( $i = 0; $i < count ( $this->list ); $i++ )
			{
				$el = $this->list[$i];
				if( $i != $index )
				{
					array_push( $ret, $el );
				}
			}
			$this->list = $ret;
		}
		
		function ReplaceAt( $index, $new_val )
		{
			$ret = array();
			for( $i = 0; $i < count ( $this->list ); $i++ )
			{
				$el = $this->list[$i];
				if( $i != $index )
				{
					array_push( $ret, $el );
				}
				else
				{
					array_push( $ret, $new_val );
				}
			}
			$this->list = $ret;
		}
		
		function Clear()
		{
			$this->list = array();
		}
		
		function Size()
		{
			return count( $this->list );
		}
		
		function ToArray()
		{
			return $this->list;
		}
	}
?>